﻿using System;
using UnityEngine;

namespace KuiHuaBaoDian.Services.Avatar {

    public readonly struct AvatarAdditionalPartSetting {

        public static readonly AvatarAdditionalPartSetting Default = new() {
            ParentBoneName = null,
            Position = Vector3.zero,
            EulerAngles = Vector3.zero,
        };

        public string ParentBoneName { get; init; }
        public Vector3 Position { get; init; }
        public Vector3 EulerAngles { get; init; }

        public override readonly int GetHashCode() {
            return HashCode.Combine(ParentBoneName, Position, EulerAngles);
        }

        public override readonly bool Equals(object obj) {
            if (obj is AvatarAdditionalPartSetting other) {
                return other.ParentBoneName == ParentBoneName && other.Position == Position && other.EulerAngles == EulerAngles;
            }
            return false;
        }

        public static bool operator ==(AvatarAdditionalPartSetting left, AvatarAdditionalPartSetting right) => left.Equals(right);

        public static bool operator !=(AvatarAdditionalPartSetting left, AvatarAdditionalPartSetting right) => !left.Equals(right);
    }
}
